import request from "./request";
import qs from 'qs'

// 登录
export const login = (data) => {
    return request({
        url: '/web/login',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 注册
export const register = (data) => {
    return request({
        url: '/web/register',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 获取用户信息
export const getUserInfo = (token) => {
    return request({
        url: '/web/getUserInfo',
        method: 'POST',
        data: qs.stringify(token)
    })
}

// 退出登录
export const logout = (id) => {
    return request({
        url: `/web/logout?id=${id}`,
        method: 'GET',
    })
}

// 忘记密码
export const forgetPassword = (data) => {
    return request({
        url: '/web/forgetPassword',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 修改密码
export const updatePassword = (data) => {
    return request({
        url: '/web/updatePassword',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 绑定手机号
export const bindPhone = (data) => {
    return request({
        url: '/web/bindPhone',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 设置资金密码
export const moneyCode = (data) => {
    return request({
        url: '/web/moneyCode',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 添加银行卡
export const addBankCard = (data) => {
    return request({
        url: '/web/addBankCard',
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 获取银行卡
export const getBankCard = (id) => {
    return request({
        url: `/web/getBankCard?id=${id}`,
        method: 'GET'
    })
}

// 身份认证
export const addIdTent = (data) => {
    return request({
        url: `/web/authentication`,
        method: 'POST',
        data: qs.stringify(data)
    })
}

// 获取身份认证信息
export const getIdTentInfo = (id) => {
    return request({
        url: `/web/getIdTentInfo?id=${id}`,
        method: 'GET'
    })
}

// 查看是否完成认证
export const isCompleteCertification = (id) => {
    return request({
        url: `/web/isCompleteCertification?id=${id}`,
        method: 'GET'
    })
}